﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;


namespace Common.Data.Scriptable
{
    
    [CreateAssetMenu(fileName = "ScriptableObjectPrefab", menuName = "Common/ObjectPrefab", order = 0)]
    public class ScriptableObjectPrefab: ScriptableObject
    {
        [Header("小房子网格信息")]
        public Mesh[] litMeshList;
        
        [Header("主楼网格信息")]
        public Mesh[] mainCityMeshList;
        
        [Header("房顶网格信息")]
        public Mesh[] roofMeshList;
        
        [Header("主楼节点")] public GameObject mainCityPre;
        
        [Header("塔吊架子")] public GameObject towerFrame;

        [Header("塔吊平台")] public GameObject track;

        [Header("操作格子")] public GameObject groundTemplate;
        
        [Header("封顶建筑")] public GameObject capping;
        
        [Header("材质消除道具使用提示用")] public Material removeRedMat;
        [Header("小房子的默认材质")] public Material litCityDefMat;
        [Header("半透明材质")] public Material transparencyMat;
        
        [Header("成就图片信息")]
        public Sprite[] buildingList;
        
        
        public Mesh GetLitCity(int types,int index)
        {
            int startIdx =( litMeshList.Length -1)  * types;
            return litMeshList[startIdx + index];
        }

        public Sprite GetBuildingSprite(string name)
        {
            for (int i = 0; i < buildingList.Length; i++)
            {
                if (buildingList[i].name == name)
                {
                    return buildingList[i];
                }
            }

            return buildingList[0];
        }
    }
}